<template>
	<view class="contain">
		<view class="top">
			<view class="top-icon">
				<u-icon name="account-fill" color="#2979ff" size="48"></u-icon>
			</view>
			<view class="top-text">
				<text>{{userInfo.userName}}</text>
			</view>
		</view>
		<button class="sign__out__button" @click="signOut">退出登录</button>
		<tabbar value="1"></tabbar>
	</view>
</template>

<script>
import request from '../../utils/request.js'
	export default {
		data() {
			return {
				userInfo:{}
			}
		},
		onLoad(){
			request({
				url: "prod-api/getInfo",
				method: "get",
			}).then((res)=>{
				if(res.code<300)
				this.userInfo=res.data.user
				console.log(res)
			})
		},
		methods: {
			signOut() {
				try {
					uni.clearStorageSync();
				} catch (e) {
					// error
				}
				uni.reLaunch({
					url: '/pages/login/index'
				});
			}
		}
	}
</script>

<style lang="scss">
.contain{
	width: 100%;
	height: 100%;
	position: absolute;
	background-color: rgb(245, 245, 245);
	.sign__out__button {
		position: fixed;
		bottom: 200rpx;
		right: 50rpx;
		left: 50rpx;
		width: 650rpx;
		height: 80rpx;
		color: #fff;
		background-color: red;
		line-height: 80rpx;
	}
	.top{
		background-color: white;
		.top-icon{
			box-sizing: border-box;
			padding-top: 50upx;
			margin-top: 20upx;
			margin-left: 50upx;
			margin-bottom: 20upx;
		}
		.top-text{	
			box-sizing: border-box;
			margin: 50upx 50upx;
			margin-top: 0upx;
			padding-bottom: 50upx;
		}
	}
}
</style>
